<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>OSC Open API</title>
    <style type="text/css">
        .left{float: left;width: 200px;background-color: #F3F3F3;}
        .right{float: left;width: 800px;height: 1000px;margin-left: 20px;}
        .title{background-color: #EDF3F9;padding-left: 20px;margin: 10px 0px;font-weight: bold;font-size: 14px;}
        .context{padding-left: 20px;font-size: 12px;}
        .example{border: 1px dashed black;padding-left: 30px;background-color: #f9f9f9;font-size: 12px;overflow: hidden;line-height: 1.1em;}
        .search_text{float: left;width: 150px;}
        .search_btn{float: left}
        .returnType{font-weight: bold;font-size: 12px;padding-left: 30px;}
        .url{font-weight: bold;}
        .clear{clear: both;}
        .return{font-size: 12px;}
    </style>
    <script type="text/javascript" src="./js/jquery.js"></script>
    <script type="text/javascript" src="./js/baidutemplate.js"></script>

    <script type="text/html" id="json">
{
    "notice": {
        "replyCount": 0, 
        "msgCount": 0, 
        "fansCount": 0, 
        "referCount": 0
    }, 
    "commentList": [
        {
            "content": "<div class=\"ref\"><h4>引用来自“张艺辰”的答案</h4><div class=ref_body>发</div></div><div class=a_body>fdsfsafdasfdsafds</div>", 
            "id": 174745, 
            "pubDate": "2013-10-09 15:24:28.0", 
            "client_type": 1, 
            "replies": [ ], 
            "commentAuthor": "张艺辰", 
            "commentAuthorId": 253479, 
            "refers": [
                {
                    "refertitle": "引用来自“张艺辰”的答案", 
                    "referbody": "<div class=\"ref_body\">
 发
</div>"
                }
            ]
        }, 
        {
            "content": "发", 
            "id": 174742, 
            "pubDate": "2013-10-09 10:39:07.0", 
            "client_type": 1, 
            "replies": [
                {
                    "rauthor": "张艺辰", 
                    "rpubDate": "2013-10-09 10:39:07.0", 
                    "rauthorId": 253479, 
                    "rcontent": "发"
                }
            ], 
            "commentAuthor": "张艺辰", 
            "commentAuthorId": 253479
        }
    ]
}
    </script>
    <script type="text/javascript">
        var data = {
            api:'/action/openapi/comment_list',
            api_desc:'获取评论列表',
            url:'/action/openapi/comment_list',
            dataType:'JSON JSONP XML',
            reqType:'GET/POST',
            require_login: '否',
            access_auth: '暂无',
            req_param: [
                {name:'id',must: true,type_range:'int',desc:'新闻ID/翻译ID/帖子ID/动弹ID/用户ID（留言中跟当前用户来往的ID）/博客ID',default:'-1'},
                {name:'catalog',must: true,type_range:'int',desc:'1-新闻/翻译|2-帖子|3-动弹|4-消息(留言 必须access_token)|5-博客',default:'-1'},
                {name:'access_token',must: false,type_range:'string',desc:'oauth2_token获取的access_token',default:''},
                {name:'page/pageIndex',must: true,type_range:'int',desc:'页数',default:'1'},
                {name:'pageSize',must: true,type_range:'int',desc:'每页条数',default:'20'},
                {name:'dataType',must: true,type_range:'string',desc:'返回数据类型[\'json\'|\'jsonp\'|\'xml\']',default:'json'}
            ],
            tip:'catalog为4的时候 查看留言列表必须提供access_token',
            resultType: 'JSON',
            ret_param: [
                {name:'commentList.id',type_range:'int',desc:'评论ID'},
                {name:'commentList.content',type_range:'string',desc:'评论内容'},
                {name:'commentList.pubDate',type_range:'datetime',desc:'发布日期'},
                {name:'commentList.client_type',type_range:'int',desc:'1-WEB、2-WAP、3-Android、4-IOS、5-WP'},
                {name:'commentList.commentAuthor',type_range:'string',desc:'评论人'},
                {name:'commentList.commentAuthorId',type_range:'int',desc:'评论人ID'},
                {name:'commentList.commentPortrait',type_range:'int',desc:'评论人头像'},
                {name:'commentList.refers.refertitle',type_range:'string',desc:'评论中引用的标题'},
                {name:'commentList.refers.referbody',type_range:'string',desc:'评论中引用的内容'},
                {name:'commentList.replies.rauthor',type_range:'string',desc:'帖子中评论 评论 的人'},
                {name:'commentList.replies.rpubDate',type_range:'datetime',desc:'帖子中评论 评论 的时间'},
                {name:'commentList.replies.rauthorId',type_range:'int',desc:'帖子中评论 评论 的人的ID'},
                {name:'commentList.replies.rcontent',type_range:'string',desc:'帖子中评论 评论 的内容'},
            ]
        };
        $(function(){
            data.result =  $("#"+data.resultType.toLowerCase()).html();
            var html = baidu.template("context",data);
            $('body').after(html);
        });
    </script>
    <script type="text/html" id="context">
        <div class="right">
            <div class="url"><%:=api%>  </div>
            <hr>
            <div class="title"><%:=api%></div>
            <div class="context"><%:=api_desc%></div>
            <div class="title">URL</div>
            <div class="context"><%:=url%></div>
            <div class="title">支持格式</div>
            <div class="context"><%:=dataType%></div>
            <div class="title">HTTP请求方式</div>
            <div class="context"><%:=reqType%></div>
            <div class="title">是否需要登录</div>
            <div class="context"><%:=require_login%></div>
            <div class="title">访问授权限制</div>
            <div class="context"><%:=access_auth%></div>
            <div class="title">请求参数</div>
            <%if(req_param.length>0) { %>
            <div class="return">
                <table  border="1" cellspacing="0" bordercolor="#000000" style="border-collapse:collapse;">
                    <tr>
                        <th width="91px"></th>
                        <th width="33px">必选</th>
                        <th width="67px">类型及范围</th>
                        <th width="531px">说明</th>
                        <th width="66px">默认值</th>
                    </tr>
                    <%for(var i=0;i<req_param.length;i++){%>
                    <tr>
                        <td><%=req_param[i].name%></td>
                        <td><%=req_param[i].must%></td>
                        <td><%=req_param[i].type_range%></td>
                        <td><%=req_param[i].desc%></td>
                        <td><%=req_param[i].default%></td>
                    </tr>
                    <%}%>

                </table>
            </div>
            <%}else{%>
            <div class="context">无</div>
            <%}%>

            <div class="title">注意事项</div>
            <div class="context"><%:=tip%>；</div>

            <div class="title">返回结果</div>
            <div class="return">
                <div class="returnType"><%=resultType%></div>
                <div class="example">
                    <pre><%:=result%>
                    </pre>
                </div>
                <div class="title">返回字段说明</div>
                <div class="return">
                    <table  border="1" cellspacing="0" bordercolor="#000000" style="border-collapse:collapse;">
                        <tr>
                            <th width="91px">返回值字段</th>
                            <th width="100px">类型及范围</th>
                            <th width="600px">说明</th>
                        </tr>
                        <%for(var i=0;i<ret_param.length;i++){%>
                        <tr>
                            <td><%=ret_param[i].name%></td>
                            <td><%=ret_param[i].type_range%></td>
                            <td><%=ret_param[i].desc%></td>
                        </tr>
                        <%}%>
                    </table>
                </div>
            </div>
        </div>
    </script>
</head>
<body>
    
</body>
</html>